package io.jt808.proto.item;


import io.norland.buffer.AutoBuffer;
import io.norland.proto.IProto;

public class PositionAdditional2AIoStatus implements IProto {
    private short status;

    public byte[] writeToBytes() {
        AutoBuffer buffer = new AutoBuffer();
        buffer.writeShort(status);
        return buffer.array();
    }

    public void readFromBuf(AutoBuffer buffer) {
        this.status = buffer.readShort();
    }

    /**
     * 深度休眠状态
     */
    public boolean isDeepSleep() {
        return (status & 1) != 0;
    }

    /**
     * 休眠状态
     */
    public boolean isSleep() {
        return (status & 1 << 1) != 0;
    }
}